import _axios from '@/plugins/axios';
import store from '@/store';
import {getParamsStr} from "../utils";

class UserAddress {
	addAddress(params) {
		let str = getParamsStr(params);
		return _axios.post('small4/user/shipping-address/add?' + str);
	}

	getDefaultAddress() {
		let token = store.state.user.token;
		return _axios.post('small4/user/shipping-address/default?token=' + token)
	}

	getAddressList() {
		let token = store.state.user.token;
		return _axios.post('small4/user/shipping-address/list?token=' + token)
	}

	setDefaultAddress(id) {
		let token = store.state.user.token;
		return _axios.post('small4/user/shipping-address/update?token=' + token + '&id=' + id)
	}
}

export default UserAddress;
